import ctypes


def int_overflow(val):
    maxint = 2147483647
    if not -maxint - 1 <= val <= maxint:
        val = (val + (maxint + 1)) % (2 * (maxint + 1)) - maxint - 1
    return val


def unsigned_right_shitf(n, i):
    # 数字小于0，则转为32位无符号uint
    if n < 0:
        n = ctypes.c_uint32(n).value
    # 正常位移位数是为正数，但是为了兼容js之类的，负数就右移变成左移好了
    if i < 0:
        return -int_overflow(n << abs(i))
    return int_overflow(n >> i)


def _0xafa97(_0x5ec83, _0x32fe0b):
    _0x2e9d05 = (_0x5ec83 & 65535) + (_0x32fe0b & 65535)
    _0x429b00 = int_overflow(_0x5ec83 >> 16) + int_overflow(_0x32fe0b >> 16) + int_overflow(_0x2e9d05 >> 16)
    return int_overflow(_0x429b00 << 16) | _0x2e9d05 & 65535


def _0x46a81e(_0xbbe71e, _0x4b5b75, _0x458d29, _0x51c38b, _0x323668, _0x2b195c, _0x407651):
    return _0xe48401(_0x4b5b75 & _0x458d29 | ~_0x4b5b75 & _0x51c38b, _0xbbe71e, _0x4b5b75, _0x323668, _0x2b195c,
                     _0x407651)


def _0x19579b(_0x68a83, _0x3e1a79):
    return int_overflow(_0x68a83 << _0x3e1a79) | unsigned_right_shitf(_0x68a83, 32 - _0x3e1a79)


def _0x5c0a4a(_0x12d75a, _0xf74bdb, _0x325a28, _0x2f4ba2, _0x3bde46, _0x187305, _0x1db81a):
    return _0xe48401(_0xf74bdb & _0x2f4ba2 | _0x325a28 & ~_0x2f4ba2, _0x12d75a, _0xf74bdb, _0x3bde46, _0x187305,
                     _0x1db81a)


def _0xe48401(_0x463c2c, _0x341fe4, _0x585c49, _0x2ee447, _0xcb189d, _0x32b050):
    return _0xafa97(_0x19579b(_0xafa97(_0xafa97(_0x341fe4, _0x463c2c), _0xafa97(_0x2ee447, _0x32b050)), _0xcb189d),
                    _0x585c49)


def _0x544f20(_0x3410f2, _0x5b1156, _0x598e45, _0x4cd61a, _0x58c64e, _0x114acd, _0x361b48):
    return _0xe48401(_0x5b1156 ^ _0x598e45 ^ _0x4cd61a, _0x3410f2, _0x5b1156, _0x58c64e, _0x114acd, _0x361b48)


def _0xae234f(_0x35584d, _0xd73f8a, _0x3e33bc, _0x397fb9, _0x327dc9, _0x5d67bc, _0x396508):
    return _0xe48401(_0x3e33bc ^ (_0xd73f8a | ~_0x397fb9), _0x35584d, _0xd73f8a, _0x327dc9, _0x5d67bc, _0x396508)


def _0x236cb6(_0x53645d):
    _0x1481ec = 1732584193
    _0x2920e8 = -271733879
    _0x125fd6 = -1732584194
    _0x157156 = 271733878
    if _0x53645d != '1':
        if type(_0x53645d) != int:
            for _0x553fe7 in range(0, len(_0x53645d), 16):
                _0x4b4382 = _0x1481ec
                _0x2f5694 = _0x2920e8
                _0x69d8f8 = _0x125fd6
                _0x1849c8 = _0x157156
                _0x1481ec = _0x46a81e(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 0], 7,
                                      -680876936)
                _0x157156 = _0x46a81e(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 1], 12,
                                      -389564586)
                _0x125fd6 = _0x46a81e(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 2], 17,
                                      606105819)
                _0x2920e8 = _0x46a81e(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 3], 22,
                                      -1044525330)
                _0x1481ec = _0x46a81e(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 4], 7,
                                      -176418897)
                _0x157156 = _0x46a81e(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 5], 12,
                                      1200080426)
                _0x125fd6 = _0x46a81e(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 6], 17,
                                      -1473231341)
                _0x2920e8 = _0x46a81e(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 7], 22,
                                      -45705983)
                _0x1481ec = _0x46a81e(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 8], 7,
                                      1770035416)
                _0x157156 = _0x46a81e(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 9], 12,
                                      -1958414417)
                _0x125fd6 = _0x46a81e(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 10], 17, -42063)
                _0x2920e8 = _0x46a81e(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 11], 22,
                                      -1990404162)
                _0x1481ec = _0x46a81e(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 12], 7,
                                      1804603682)
                _0x157156 = _0x46a81e(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 13], 12,
                                      -40341101)
                _0x125fd6 = _0x46a81e(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 14], 17,
                                      -1502002290)
                _0x2920e8 = _0x46a81e(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 15], 22,
                                      1236535329)
                _0x1481ec = _0x5c0a4a(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 1], 5,
                                      -165796510)
                _0x157156 = _0x5c0a4a(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 6], 9,
                                      -1069501632)
                _0x125fd6 = _0x5c0a4a(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 11], 14,
                                      643717713)
                _0x2920e8 = _0x5c0a4a(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 0], 20,
                                      -373897302)
                _0x1481ec = _0x5c0a4a(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 5], 5,
                                      -701558691)
                _0x157156 = _0x5c0a4a(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 10], 9,
                                      38016083)
                _0x125fd6 = _0x5c0a4a(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 15], 14,
                                      -660478335)
                _0x2920e8 = _0x5c0a4a(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 4], 20,
                                      -405537848)
                _0x1481ec = _0x5c0a4a(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 9], 5,
                                      568446438)
                _0x157156 = _0x5c0a4a(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 14], 9,
                                      -1019803690)
                _0x125fd6 = _0x5c0a4a(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 3], 14,
                                      -187363961)
                _0x2920e8 = _0x5c0a4a(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 8], 20,
                                      1163531501)
                _0x1481ec = _0x5c0a4a(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 13], 5,
                                      -1444681467)
                _0x157156 = _0x5c0a4a(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 2], 9,
                                      -51403784)
                _0x125fd6 = _0x5c0a4a(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 7], 14,
                                      1735328473)
                _0x2920e8 = _0x5c0a4a(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 12], 20,
                                      -1926607734)
                _0x1481ec = _0x544f20(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 5], 4, -378558)
                _0x157156 = _0x544f20(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 8], 11,
                                      -2022574463)
                _0x125fd6 = _0x544f20(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 11], 16,
                                      1839030562)
                _0x2920e8 = _0x544f20(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 14], 23,
                                      -35309556)
                _0x1481ec = _0x544f20(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 1], 4,
                                      -1530992060)
                _0x157156 = _0x544f20(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 4], 11,
                                      1272893353)
                _0x125fd6 = _0x544f20(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 7], 16,
                                      -155497632)
                _0x2920e8 = _0x544f20(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 10], 23,
                                      -1094730640)
                _0x1481ec = _0x544f20(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 13], 4,
                                      681279174)
                _0x157156 = _0x544f20(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 0], 11,
                                      -358537222)
                _0x125fd6 = _0x544f20(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 3], 16,
                                      -722521979)
                _0x2920e8 = _0x544f20(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 6], 23,
                                      76029189)
                _0x1481ec = _0x544f20(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 9], 4,
                                      -640364487)
                _0x157156 = _0x544f20(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 12], 11,
                                      -421815835)
                _0x125fd6 = _0x544f20(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 15], 16,
                                      530742520)
                _0x2920e8 = _0x544f20(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 2], 23,
                                      -995338651)
                _0x1481ec = _0xae234f(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 0], 6,
                                      -198630844)
                _0x157156 = _0xae234f(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 7], 10,
                                      1126891415)
                _0x125fd6 = _0xae234f(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 14], 15,
                                      -1416354905)
                _0x2920e8 = _0xae234f(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 5], 21,
                                      -57434055)
                _0x1481ec = _0xae234f(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 12], 6,
                                      1700485571)
                _0x157156 = _0xae234f(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 3], 10,
                                      -1894986606)
                _0x125fd6 = _0xae234f(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 10], 15,
                                      -1051523)
                _0x2920e8 = _0xae234f(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 1], 21,
                                      -2054922799)
                _0x1481ec = _0xae234f(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 8], 6,
                                      1873313359)
                _0x157156 = _0xae234f(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 15], 10,
                                      -30611744)
                _0x125fd6 = _0xae234f(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 6], 15,
                                      -1560198380)
                _0x2920e8 = _0xae234f(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 13], 21,
                                      1309151649)
                _0x1481ec = _0xae234f(_0x1481ec, _0x2920e8, _0x125fd6, _0x157156, _0x53645d[_0x553fe7 + 4], 6,
                                      -145523070)
                _0x157156 = _0xae234f(_0x157156, _0x1481ec, _0x2920e8, _0x125fd6, _0x53645d[_0x553fe7 + 11], 10,
                                      -1120210379)
                _0x125fd6 = _0xae234f(_0x125fd6, _0x157156, _0x1481ec, _0x2920e8, _0x53645d[_0x553fe7 + 2], 15,
                                      718787259)
                _0x2920e8 = _0xae234f(_0x2920e8, _0x125fd6, _0x157156, _0x1481ec, _0x53645d[_0x553fe7 + 9], 21,
                                      -343485551)
                _0x1481ec = _0xafa97(_0x1481ec, _0x4b4382)
                _0x2920e8 = _0xafa97(_0x2920e8, _0x2f5694)
                _0x125fd6 = _0xafa97(_0x125fd6, _0x69d8f8)
                _0x157156 = _0xafa97(_0x157156, _0x1849c8)

        return [
            _0x1481ec,
            _0x2920e8,
            _0x125fd6,
            _0x157156
        ]
    else:
        return [
            _0x1481ec,
            _0x157156,
            _0x125fd6,
            _0x2920e8
        ]


def _0x2f6ff0(_0x1c21a3):
    _0x1683e8 = ''.join([str(i) for i in _0x236cb6(1)]) + _0x1c21a3
    return _0x1683e8.replace("-", "").replace("|", "").replace(",", "")


def _0x2f6ff0(_0x1c21a3):
    _0x1683e8 = ''.join([str(i) for i in _0x236cb6(1)]) + _0x1c21a3
    return _0x1683e8.replace("-", "").replace("|", "").replace(",", "")


def _0x49c973(_0x1b1d82):
    _0x4d0025 = (len(_0x1b1d82) + 8 >> 6) + 1
    _0x51bd6e = [0 for _ in range(_0x4d0025 * 16)]
    for _0x1bca39 in range(len(_0x1b1d82)):
        _0x51bd6e[_0x1bca39 >> 2] |= (ord(_0x1b1d82[_0x1bca39]) & 255) << _0x1bca39 % 4 * 8
    _0x1bca39 = len(_0x1b1d82)
    _0x51bd6e[_0x1bca39 >> 2] |= 128 << _0x1bca39 % 4 * 8
    _0x51bd6e[_0x4d0025 * 16 - 2] = len(_0x1b1d82) * 8
    return _0x51bd6e


def _0x5a9f8d(_0x481941):
    _0x37a9b6 = '0123456789abcdef'
    _0x10e7c8 = ''
    for _0x3e7ad4 in range(len(_0x481941) * 4):
        _0x10e7c8 += _0x37a9b6[_0x481941[_0x3e7ad4 >> 2] >> _0x3e7ad4 % 4 * 8 + 4 & 15] + _0x37a9b6[
            _0x481941[_0x3e7ad4 >> 2] >> _0x3e7ad4 % 4 * 8 & 15]
    return _0x10e7c8


def lc(_0x5b9fd2):
    """
    签名算法
    :param _0x5b9fd2:数据
    :return: 签名
    """
    return _0x5a9f8d(_0x236cb6(_0x49c973(_0x2f6ff0(_0x5b9fd2))))
